home *** CD-ROM | disk | FTP | other *** search
- global gValidKeyList, gUpperCaseTable
-
- on startMovie
- installMenu("menu")
- set the visible of sprite 8 to 0
- set gValidKeyList to ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "?", "!", ",", ".", "-", "$", " ", "@", TAB]
- set gUpperCaseTable to ["!": 33, "$": 36, ",": 44, "-": 45, ".": 46, "0": 48, "1": 49, "2": 50, "3": 51, "4": 52, "5": 53, "6": 54, "7": 55, "8": 56, "9": 57, "?": 63, "a": 65, "b": 66, "c": 67, "d": 68, "e": 69, "f": 70, "g": 71, "h": 72, "i": 73, "j": 74, "k": 75, "l": 76, "m": 77, "n": 78, "o": 79, "p": 80, "q": 81, "r": 82, "s": 83, "t": 84, "u": 85, "v": 86, "w": 87, "x": 88, "y": 89, "z": 90, "@": 64]
- end
-
- on encode
- if field "encode:name" = EMPTY then
- alert("Please enter your name!")
- exit
- end if
- if field "To be Encoded" = EMPTY then
- alert("There is no message to encode!")
- exit
- end if
- set temp to EMPTY
- set nameField to convertToUpperCase(the text of field "encode:name")
- repeat with y = 1 to the number of chars in nameField
- set holder to charToNum(char y of nameField) + 5
- set holder to numToChar(holder)
- put holder after temp
- end repeat
- put "!" after temp
- set messageField to convertToUpperCase(the text of field "To be Encoded")
- repeat with x = 1 to the number of chars in messageField
- set holder to charToNum(char x of messageField) + 5
- set holder to numToChar(holder)
- put holder after temp
- end repeat
- doSomeFancyStuff()
- put temp into field "encode:result"
- end
-
- on decode
- set the editable of member "To be Decoded" to 0
- puppetTransition(3)
- updateStage()
- if field "To be Decoded" = EMPTY then
- alert("Please enter the message you want to encode!")
- puppetTransition(3)
- set the editable of member "To be Decoded" to 1
- abort()
- end if
- if the number of chars in field "To be Decoded" > 100 then
- alert("The message is not properly formated:" & RETURN & "Message too long!")
- puppetTransition(3)
- set the editable of member "To be Decoded" to 1
- abort()
- end if
- checkForValidFormate()
- set temp to EMPTY
- repeat with x = 1 to the number of chars in field "To be Decoded"
- set holder to charToNum(char x of field "To be Decoded") - 5
- if holder = 28 then
- set nameOfSender to temp
- set temp to EMPTY
- next repeat
- end if
- set holder to numToChar(holder)
- put holder after temp
- end repeat
- set deCodeResult to temp
- set nameOfSender to checkBadWord(nameOfSender)
- set deCodeResult to checkBadWord(deCodeResult)
- displayResult(nameOfSender, deCodeResult)
- end
-
- on checkBadWord theString
- repeat with i = 1 to the number of words in theString
- repeat with j = 1 to the number of words in field "bad words"
- if word i of theString = word j of field "bad words" then
- repeat with k = 1 to the number of chars in word i of theString
- put "?" into char k of word i of theString
- end repeat
- next repeat
- end if
- next repeat
- end repeat
- end repeat
- return theString
- end
-
- on checkForValidFormate
- if field "To be Decoded" contains "!" then
- set the itemDelimiter to "!"
- if the number of items in field "To be Decoded" > 2 then
- alert("This message is not properly formated!")
- puppetTransition(3)
- set the editable of member "To be Decoded" to 1
- abort()
- end if
- if the number of chars in item 1 of field "To be Decoded" > 15 then
- alert("This message is not properly formated:" & RETURN & "sender's name too long.")
- puppetTransition(3)
- set the editable of member "To be Decoded" to 1
- abort()
- end if
- else
- alert("This message is not properly formated:" & RETURN & "sender's name missing")
- puppetTransition(3)
- set the editable of member "To be Decoded" to 1
- abort()
- end if
- end
-
- on convertToUpperCase toConvert
- set convertedString to EMPTY
- repeat with i = 1 to the number of chars in toConvert
- if charToNum(char i of toConvert) > 90 then
- set convertedChar to numToChar(getProp(gUpperCaseTable, char i of toConvert))
- put convertedChar after convertedString
- next repeat
- end if
- put char i of toConvert after convertedString
- end repeat
- return convertedString
- end
-
- on clearAllFields
- repeat with x = 1 to the number of castMembers of castLib 1
- if the type of member x = #field then
- put EMPTY into field x
- end if
- updateStage()
- end repeat
- if the frame = 10 then
- puppetTransition(3)
- updateStage()
- end if
- end
-
- on CopyTheResult
- if field "encode:result" = EMPTY then
- alert("There is no secret code to copy!!")
- end if
- copyToClipBoard(member "encode:result")
- end
-
- on Paste
- pasteClipBoardInto(member 1000 of castLib 1)
- set the name of member 1000 of castLib 1 to "xxx"
- if not (the type of member 1000 of castLib 1 = #field) then
- alert("The ClipBpard contains invalid information!")
- else
- if the number of chars in the text of member 1000 of castLib 1 > 99 then
- alert("The ClipBpard contains invalid information!")
- else
- put the text of member 1000 of castLib 1 into field "To be Decoded"
- end if
- end if
- end
-
- on doSomeFancyStuff
- if the optionDown then
- return
- end if
- set the memberNum of sprite 12 to the number of member "Hand Up"
- DoUpAndDown(1)
- set the memberNum of sprite 12 to the number of member "Operating"
- puppetSound("encoding sound")
- set the visible of sprite 8 to 1
- repeat with i = 1 to 70
- startTimer()
- repeat while the timer < 7
- nothing()
- end repeat
- updateStage()
- end repeat
- set the visible of sprite 8 to 0
- set the memberNum of sprite 12 to the number of member "Hand Down"
- DoUpAndDown(0)
- puppetSound("finished encoding sound")
- updateStage()
- end
-
- on DoUpAndDown x
- if x then
- puppetSprite(12, 1)
- end if
- repeat with i = 1 to 5
- updateStage()
- startTimer()
- repeat while the timer < 10
- nothing()
- end repeat
- end repeat
- if not x then
- set the memberNum of sprite 12 to the number of member "standBy"
- puppetSprite(12, 0)
- end if
- end
-
- on displayResult nameOfSender, deCodeResult
- doSomeFancyStuff()
- set the loc of sprite 3 to point(300, 235)
- repeat with i = 1 to the number of chars in nameOfSender
- puppetSound("rotating letter sound")
- updateStage()
- spinTheLetter(3)
- if not getOne(gValidKeyList, char i of nameOfSender) then
- set the memberNum of sprite 3 to the number of member "?"
- else
- if char i of nameOfSender = " " then
- set the memberNum of sprite 3 to the number of member "blank"
- else
- set the memberNum of sprite 3 to the number of member char i of nameOfSender
- end if
- end if
- set the trails of sprite 3 to 1
- puppetSound("rotating letter stop sound")
- updateStage()
- repeat while soundBusy(1)
- nothing()
- end repeat
- updateStage()
- set the trails of sprite 3 to 0
- if i = the number of chars in nameOfSender then
- set the trails of sprite 3 to 1
- exit repeat
- end if
- set the locH of sprite 3 to the locH of sprite 3 + 14
- set the editable of member "To be Decoded" to 1
- puppetSound("rotating letter sound")
- updateStage()
- end repeat
- set the loc of sprite 4 to point(230, 281)
- set numOfChars to the number of chars in deCodeResult
- set numOffSet to 0
- repeat with i = 1 to numOfChars
- puppetSound("rotating letter sound")
- updateStage()
- spinTheLetter(4)
- if (i = 21) or (i = 42) or (i = 63) then
- if char i - numOffSet - 1 of deCodeResult = " " then
- set the memberNum of sprite 4 to the number of member "blank"
- set numOffSet to numOffSet + 1
- set numOfChars to numOfChars + 1
- else
- if (char i - numOffSet + 1 of deCodeResult <> " ") and (char i - numOffSet of deCodeResult <> " ") then
- set the memberNum of sprite 4 to the number of member "-"
- set numOffSet to numOffSet + 1
- set numOfChars to numOfChars + 1
- end if
- end if
- else
- if not getOne(gValidKeyList, char i - numOffSet of deCodeResult) then
- set the memberNum of sprite 4 to the number of member "?"
- else
- if char i - numOffSet of deCodeResult = " " then
- set the memberNum of sprite 4 to the number of member "blank"
- else
- set the memberNum of sprite 4 to the number of member char i - numOffSet of deCodeResult
- end if
- end if
- end if
- set the trails of sprite 4 to 1
- puppetSound("rotating letter stop sound")
- updateStage()
- repeat while soundBusy(1)
- nothing()
- end repeat
- updateStage()
- set the trails of sprite 4 to 0
- case i of
- 21:
- set the loc of sprite 4 to point(230, 281) + point(0, 27)
- 42:
- set the loc of sprite 4 to point(230, 281) + point(0, 54)
- 63:
- set the loc of sprite 4 to point(230, 281) + point(0, 81)
- otherwise:
- set the locH of sprite 4 to the locH of sprite 4 + 14
- end case
- end repeat
- end
-
- on spinTheLetter x
- repeat with i = 1 to 10
- set nextMem to the memberNum of sprite x + 1
- if nextMem >= (the number of member "blank" + 3) then
- set nextMem to the number of member "blank"
- end if
- set the memberNum of sprite x to nextMem
- updateStage()
- startTimer()
- repeat while the timer < 2
- nothing()
- end repeat
- end repeat
- end
-